home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- * Communications Routines for the IBM PC and compatables *
- * *
- * Supporting any combination of IRQ and base address, speeds up to 38,400 *
- * BPS. *
- * *
- * (C) Copyright 1991 by Leo Bicknell, All Rights Reserved. Duplication of *
- * this source code in any form, in whole or in part, without written *
- * permition from the author is expressly prohibited *
- * *
- ***************************** Revision History *******************************
- * *
- * 07/07/91 - Origional write finished; *
- * Leo Bicknell *
- * *
- * 08/02/91 - Fixup for distribution *
- * *
- ******************************************************************************/
-
- #ifndef LEOCOM
- #define LEOCOM
-
- #define DATA8 0x03 /* 8 Data bits */
- #define DATA7 0x02 /* 7 Data bits */
- #define DATA6 0x01 /* 6 Data bits */
- #define DATA5 0x00 /* 5 Data bits */
-
- #define STOP2 0x04 /* 2 Stop Bits */
- #define STOP1 0x00 /* 1 Stop Bit */
-
- #define PNONE 0x00 /* No Parity */
- #define PODD 0x08 /* Odd Parity */
- #define PEVEN 0x18 /* Even Parity */
-
- /* Baud Rate Divisors */
- #define BAUD300 384
- #define BAUD1200 96
- #define BAUD2400 48
- #define BAUD9600 12
- #define BAUD1920 6
- #define BAUD3840 3
-
- #define IM4 ~0x10 /* Interrupt Mask, bit 4 (IRQ4, COM1) */
- #define IM3 ~0x08 /* Interrupt Mask, bit 3 (IRQ3, COM2) */
-
- #ifndef TRUE
- #define TRUE 1
- #define FALSE 0
- #define HIGH TRUE
- #define LOW FALSE
- #endif
-
-
- /* Macro Prototypes */
- int mkbhit(void);
- int mdcd(void);
- int mcts(void);
- int mdsr(void);
-
- /* Macros */
- #define mkbhit() (bufcount?TRUE:FALSE)
- #define mdcd() ((modemstatus&DCD)?TRUE:FALSE)
- #define mcts() ((modemstatus&CTS)?TRUE:FALSE)
- #define mdsr() ((modemstatus&DSR)?TRUE:FALSE)
-
-
- /* Public varable definitions */
-
- extern volatile int breakcount;
- extern volatile int framingcount;
- extern volatile int paritycount;
- extern volatile int overruncount;
- extern volatile char breakchange;
- extern volatile char framingchange;
- extern volatile char paritychange;
- extern volatile char overrunchange;
- extern volatile int modemstatus;
- extern volatile int bufcount;
-
- /* Prototypes for PUBLIC functions */
-
- int mprintf(char *c, ...);
- void mclear(void);
- int mclose(void);
- int mopen(int baud, int word, int parity, int stop, int BASE, int VECTOR, int MASK);
- int mputs(char *s);
- int mputc(int c);
- int mgetc(void);
- void msdtr(int state);
- void msrts(int state);
- void msbreak(void);
-
- #endif
-